package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.SysSupers;
import com.ruoyi.system.service.ISysSupersService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 监测人员辅助信息Controller
 * 
 * @author ruoyi
 * @date 2022-05-11
 */
@RestController
@RequestMapping("/system/supers")
public class SysSupersController extends BaseController
{
    @Autowired
    private ISysSupersService sysSupersService;

    /**
     * 查询监测人员辅助信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:supers:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysSupers sysSupers)
    {
        startPage();
        List<SysSupers> list = sysSupersService.selectSysSupersList(sysSupers);
        return getDataTable(list);
    }

    /**
     * 导出监测人员辅助信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:supers:export')")
    @Log(title = "监测人员辅助信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SysSupers sysSupers)
    {
        List<SysSupers> list = sysSupersService.selectSysSupersList(sysSupers);
        ExcelUtil<SysSupers> util = new ExcelUtil<SysSupers>(SysSupers.class);
        util.exportExcel(response, list, "监测人员辅助信息数据");
    }

    /**
     * 获取监测人员辅助信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:supers:query')")
    @GetMapping(value = "/{superId}")
    public AjaxResult getInfo(@PathVariable("superId") Long superId)
    {
        return AjaxResult.success(sysSupersService.selectSysSupersBySuperId(superId));
    }

    /**
     * 新增监测人员辅助信息
     */
    @PreAuthorize("@ss.hasPermi('system:supers:add')")
    @Log(title = "监测人员辅助信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysSupers sysSupers)
    {
        return toAjax(sysSupersService.insertSysSupers(sysSupers));
    }

    /**
     * 修改监测人员辅助信息
     */
    @PreAuthorize("@ss.hasPermi('system:supers:edit')")
    @Log(title = "监测人员辅助信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysSupers sysSupers)
    {
        return toAjax(sysSupersService.updateSysSupers(sysSupers));
    }

    /**
     * 删除监测人员辅助信息
     */
    @PreAuthorize("@ss.hasPermi('system:supers:remove')")
    @Log(title = "监测人员辅助信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{superIds}")
    public AjaxResult remove(@PathVariable Long[] superIds)
    {
        return toAjax(sysSupersService.deleteSysSupersBySuperIds(superIds));
    }
}
